<%@ page import="com.pyrsana.faith.membership.User" %>
<!doctype html>
<html>
	<head>
		<meta name="layout" content="main">
		<g:set var="username" value="${userInstance?.username ?: 'Unknown User'}" />
		<title>${username}</title>
	</head>
	<body>
		<div class="content">
			<h1>${username}</h1>
			<g:if test="${flash.message}">
				<div class="message" role="status">${flash.message}</div>
			</g:if>
			<ol class="property-list user">
			
				<g:if test="${userInstance?.profile}">
					<li class="fieldcontain">
						<span id="profile-label" class="property-label"><g:message code="user.profile.label" default="Profile" /></span>
						<span class="property-value" aria-labelledby="profile-label"><g:link controller="profile" action="show" id="${userInstance?.profile?.id}">${userInstance?.profile?.encodeAsHTML()}</g:link></span>
					</li>
				</g:if>
			
				<li class="fieldcontain">
					<span id="dateCreated-label" class="property-label"><g:message code="user.dateCreated.label" default="Date Created" /></span>
					<span class="property-value" aria-labelledby="dateCreated-label"><putils:formatDate date="${userInstance?.dateCreated}" /></span>
				</li>
				
				<li class="fieldcontain">
					<span id="lastUpdated-label" class="property-label"><g:message code="user.lastUpdated.label" default="Last Updated" /></span>
					<span class="property-value" aria-labelledby="lastUpdated-label"><putils:formatDate date="${userInstance?.lastUpdated}" /></span>
				</li>
			
				
				<sec:ifAnyGranted roles="ROLE_ADMIN, ROLE_DIRECTOR">
					<li class="fieldcontain">
						<span id="accountExpired-label" class="property-label"><g:message code="user.accountExpired.label" default="Account Expired" /></span>
						<span class="property-value" aria-labelledby="accountExpired-label"><g:formatBoolean boolean="${userInstance?.accountExpired}" /></span>
					</li>
					
					<li class="fieldcontain">
						<span id="accountLocked-label" class="property-label"><g:message code="user.accountLocked.label" default="Account Locked" /></span>
						<span class="property-value" aria-labelledby="accountLocked-label"><g:formatBoolean boolean="${userInstance?.accountLocked}" /></span>
					</li>
					
					<li class="fieldcontain">
						<span id="enabled-label" class="property-label"><g:message code="user.enabled.label" default="Enabled" /></span>
						<span class="property-value" aria-labelledby="enabled-label"><g:formatBoolean boolean="${userInstance?.enabled}" /></span>
					</li>
	
					<li class="fieldcontain">
						<span id="passwordExpired-label" class="property-label"><g:message code="user.passwordExpired.label" default="Password Expired" /></span>
						<span class="property-value" aria-labelledby="passwordExpired-label"><g:formatBoolean boolean="${userInstance?.passwordExpired}" /></span>
					</li>
				</sec:ifAnyGranted>
			
			</ol>
			<g:form>
				<fieldset class="buttons center">
					<g:hiddenField name="id" value="${userInstance?.id}" />
					<g:link class="edit" action="edit" id="${userInstance?.id}"><g:message code="default.button.edit.label" default="Edit" /></g:link>
					<%--
						// Delete currently incomplete. Would leave orphan records in database.
						<g:actionSubmit class="delete" action="delete" value="${message(code: 'default.button.delete.label', default: 'Delete')}" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');" />
					--%>
				</fieldset>
			</g:form>
		</div>
	</body>
</html>
